//
//  SKU_DetailTakeinDefault_Cell_WX.m
//  ZITHER
//
//  Created by weixin on 2019/2/24.
//  Copyright © 2019 weixn. All rights reserved.
//

#import "SKU_DetailTakeinDefault_Cell_WX.h"

@implementation SKU_DetailTakeinDefault_Cell_WX

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self setUI];
    [self setMasonry];
    self.viewBorder.hidden = NO;
    self.viewBorder.backgroundColor = HexColor(0xeeeeee);
    [self.viewBorder mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(0);
        make.right.equalTo(self).offset(0);
        make.height.mas_equalTo(1);
        make.bottom.equalTo(self).offset(0);
    }];
}

-(void)setOpMpdel:(OpenGoodsSourceInfoModel *)opMpdel{
    _opMpdel = opMpdel;
    
    [self.userInfoV mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(0);
    }];
    self.userInfoV.hidden = YES;
    self.mapBtn.hidden = NO;
    [self.mapBtn setTitle:self.opMpdel.city forState:UIControlStateNormal];
    self.trash.hidden = YES;
    [self.ReceiveBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.scrollview.mas_bottom).offset(20);
        make.height.mas_equalTo(35);
        make.bottom.mas_equalTo(self).offset(-20);
    }];
    
    [self.price mas_updateConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.userInfoV.mas_bottom).offset(0);
        make.height.mas_equalTo(0);
    }];
    self.CommoditySynopsis.text = self.opMpdel.sourceDesc;
    
    [self.scrollview addScrImage:self.opMpdel.fileList imageHeight:70];

    [self.ReceiveBtn setTitle:@"提醒商家报价" forState:UIControlStateNormal];
    
    if ([opMpdel.isRemind isEqualToString:@"1"]) {
        self.ReceiveBtn.enabled = NO;
        self.ReceiveBtn.alpha = 0.5;
        [self.ReceiveBtn setTitle:@"已提醒商家报价" forState:UIControlStateNormal];
    }
    
    
//    self.model.bizGoodsSourceAttributes = self.opMpdel.bizGoodsSourceAttributes;
    if (self.type == SKU_DetailTakeinDefault_Cell_TypePulling) {
        [self setString:self.opMpdel.bizGoodsSourceAttributes];

    }
    
//    [self.ReceiveBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(self.scrollview.mas_bottom).offset(20);
//        make.right.equalTo(self).offset(-15);
//        make.height.mas_equalTo(35);
//        make.width.mas_equalTo(120);
//        make.bottom.mas_equalTo(self).offset(-20);
//    }];

//    self.price.text = [NSString stringWithFormat:@"¥ %@", [self funcChangePrice:opMpdel.goodSourcePrice]];
//    self.CommoditySynopsis.text = opMpdel.sourceDesc;
//    
//    [self.scrollview addScrImage:self.model.fileList imageHeight:70];
//    
//    //    [self addSubview:self.scrollview];//图片滑动
//    NSMutableString *textViewSubarr = [[NSMutableString alloc]init];
//    NSMutableString *CommoditySynopsisarr = [[NSMutableString alloc]init];
//    self.textViewSub.text = @"";
//    self.textView.text = @"";
//    
//    if (opMpdel.bizGoodsSourceAttributes.count  >0) {
//        
//        for (NSDictionary *dic in opMpdel.bizGoodsSourceAttributes) {
//            if ([dic[@"groupIn"] isEqualToString:@"status"] ) {
//                [textViewSubarr appendString:[NSString stringWithFormat:@"%@ | ",dic[@"itemValue"]]];
//            }else{
//                [CommoditySynopsisarr appendString:[NSString stringWithFormat:@"%@ ",dic[@"itemValue"]]];
//            }
//        }
//        self.textViewSub.text = textViewSubarr;
//        self.textView.text = CommoditySynopsisarr;
//        
//        [self.textViewSub mas_updateConstraints:^(MASConstraintMaker *make) {
//            make.top.equalTo(self.textView.mas_bottom).offset(5);
//        }];
//        
//        
//        [self.textView mas_updateConstraints:^(MASConstraintMaker *make) {
//            make.top.equalTo(self.price.mas_bottom).offset(10);
//        }];
//        
//    }else{
//        
//        [self.textViewSub mas_updateConstraints:^(MASConstraintMaker *make) {
//            make.top.equalTo(self.textView.mas_bottom).offset(0);
//        }];
//        
//        
//        [self.textView mas_updateConstraints:^(MASConstraintMaker *make) {
//            make.top.equalTo(self.price.mas_bottom).offset(0);
//        }];
//    }
//    
    
}



-(void)setReceiving{
    if (self.type == SKU_DetailTakeinDefault_Cell_TypeReceive) {
        [self.userInfoV mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(200);
        }];
        self.userInfoV.hidden = NO;
        self.userInfoV.model = self.model;
        self.mapBtn.hidden = YES;
        self.trash.hidden = YES;
        [self.ReceiveBtn mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.scrollview.mas_bottom).offset(0);
            make.height.mas_equalTo(0);
            make.bottom.mas_equalTo(self).offset(-20);
        }];

        
    }else if(self.type == SKU_DetailTakeinDefault_Cell_TypeNOReceive){
        self.mapBtn.hidden = NO;
        [self.mapBtn setTitle:self.model.city forState:UIControlStateNormal];
        self.trash.hidden = NO;
        [self.userInfoV mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(0);
        }];
        self.userInfoV.hidden = YES;
        
        [self.ReceiveBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.scrollview.mas_bottom).offset(20);
            make.height.mas_equalTo(35);
            make.bottom.mas_equalTo(self).offset(-20);
        }];
        
    }else if(self.type == SKU_DetailTakeinDefault_Cell_TypeNOReceiveAndLoseInterest){
        self.mapBtn.hidden = NO;
        [self.mapBtn setTitle:self.model.city forState:UIControlStateNormal];
        self.trash.hidden = YES;
        [self.userInfoV mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(0);
        }];
        self.userInfoV.hidden = YES;
        [self.ReceiveBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.scrollview.mas_bottom).offset(20);
            make.height.mas_equalTo(35);
            make.bottom.mas_equalTo(self).offset(-20);
        }];
//        self.
        
    }else{
        [self.userInfoV mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(0);
        }];
        self.userInfoV.hidden = YES;

    }
 
    if (self.type == SKU_DetailTakeinDefault_Cell_TypeNOReceive ||
       self.type == SKU_DetailTakeinDefault_Cell_TypeNOReceiveAndLoseInterest ||self.type == SKU_DetailTakeinDefault_Cell_TypeReceive){
  

    }else{
        self.price.text = [NSString stringWithFormat:@"¥ %@", [self funcChangePrice:self.model.goodSourcePrice]];
    }
    
    NSString *str = @"";
    if (self.model.goodsSourcePrice.length>0) {
        str = self.model.goodsSourcePrice;
    }else{
       str = self.model.goodSourcePrice;
    }
    
    
    
    
    self.price.text = [NSString stringWithFormat:@"¥ %@", [self funcChangePrice:str]];
 
    
    self.CommoditySynopsis.text = self.model.sourceDesc;
    
    [self.scrollview addScrImage:self.model.fileList imageHeight:70];
    
    //    [self addSubview:self.scrollview];//图片滑动
    [self setString:self.model.bizGoodsSourceAttributes];

   
    
}

-(void)setString:(NSArray*)arr{
    
    //self.model.bizGoodsSourceAttributes
    NSMutableString *textViewSubarr = [[NSMutableString alloc]init];
    NSMutableString *CommoditySynopsisarr = [[NSMutableString alloc]init];
    self.textViewSub.text = @"";
    self.textView.text = @"";
    
    if (arr.count  >0) {
        
        [self.textViewSub mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.textView.mas_bottom).offset(5);
        }];
        
        
        [self.textView mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.price.mas_bottom).offset(10);
        }];
        
    }else{
        
        [self.textViewSub mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.textView.mas_bottom).offset(0);
        }];
        
        
        [self.textView mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.price.mas_bottom).offset(0);
        }];
    }
    
    
    for (NSDictionary *dic in arr) {
        
        if ([dic[@"groupIn"] isEqualToString:@"status"] ) {
            
//            [textViewSubarr appendString:[self parseAttribute:dic[@"itemKey"]]];
            [textViewSubarr appendString:[NSString stringWithFormat:@"%@ | ",[self parseAttribute:dic[@"itemKey"] dic:dic]]];
        }else{
//            [CommoditySynopsisarr appendString:[self parseAttribute:dic[@"itemKey"]]];

            [CommoditySynopsisarr appendString:[NSString stringWithFormat:@"%@ ",[self parseAttribute:dic[@"itemKey"] dic:dic]]];
        }
    }
    self.textViewSub.text = textViewSubarr;
    self.textView.text = CommoditySynopsisarr;
}

-(NSString*)parseAttribute:(NSString*)str dic:(NSDictionary*)dic{

    NSString* KEY_STATUS_OF_NEW = @"statusOfNew";
    NSString* KEY_ORIGINAL_BAND = @"originalBand";
    NSString* KEY_METAL_BAND = @"metalBand";
    NSString* KEY_SET_DIAMOND = @"setDiamond";
    NSString* KEY_INSURANCE_CARD = @"insuranceCard";
    NSString* KEY_INSTRUCATION = @"instruction";
    NSString* KEY_BOX = @"box";
    NSString* KEY_DIAL_POINTER = @"dialPointer";
    NSString* KEY_SCREW_DRIVER = @"screwDriver";

    
        if ([str isEqualToString:KEY_STATUS_OF_NEW]) {
            return [NSString stringWithFormat:@"%@新",dic[@"itemValue"]];
        } else if ([str isEqualToString:KEY_ORIGINAL_BAND]) {
            return @"原装表带";
        } else if ([str isEqualToString:KEY_METAL_BAND]) {
            return [NSString stringWithFormat:@"金属表带%@节",dic[@"itemValue"]];
        } else if ([str isEqualToString:KEY_DIAL_POINTER]) {
            return @"调表针";
        } else if ([str isEqualToString:KEY_SET_DIAMOND]) {
            if ([str isEqualToString:(@"1")]) {
                return @"后加钻石";
            } else {
                return @"原装钻石";
            }

        } else if ([str isEqualToString:KEY_INSTRUCATION]) {
            return @"说明书";
        } else if ([str isEqualToString:KEY_SCREW_DRIVER]) {
            return @"螺丝刀";
        } else if ([str isEqualToString:KEY_INSURANCE_CARD]) {
            NSString *string = dic[@"itemValue"];
            if (![self isBlankString:string]) {
                return [NSString stringWithFormat:@"保卡 %@",string];
            } else {
                return @"保卡 空白保卡";
            }
        } else if ([str isEqualToString:KEY_BOX]) {
            return @"盒子";
        }
    
    return @"";
}
-  (BOOL) isBlankString:(NSString *)string {
    
    string = [NSString stringWithFormat:@"%@",string];
    if (string.length==0) {
        return YES;
    }
    
    if ([string isEqualToString:@"null"]) {
        return YES;
    }
    if (string == nil || string == NULL) {
        return YES;
    }
    if ([string isKindOfClass:[NSNull class]]) {
        return YES;
    }
    if ([[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0) {
        return YES;
    }
    if ([[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0) {
        return YES;
    }
    
    return NO;
    
}

-(NSString*)funcChangePrice:(NSString *)price{
    int priceInt = [price intValue];
    NSNumberFormatter *moneyFormatter = [[NSNumberFormatter alloc] init];
    moneyFormatter.positiveFormat = @"###,##0";
    NSString *formatString = [moneyFormatter stringFromNumber:@(priceInt)];
    return formatString;
}

-(void)setModel:(AcceptPriceListModel *)model{
    _model = model;

    if (self.type == SKU_DetailTakeinDefault_Cell_TypeReceive) {
        
    }else{
        if ([model.isInterest isEqualToString:@"0"]) {
            self.type = SKU_DetailTakeinDefault_Cell_TypeNOReceive;//未接受报价
            self.trash.selected = NO;

            //        SKU_DetailTakeinDefault_Cell_TypeNOReceiveAndLoseInterest, //不感兴趣的未接受报价
        }else{
            self.trash.selected = YES;


//            self.type = trash; //不感兴趣的未接受报价
        }
        [self chageBtn];
    }
 
    
    [self setReceiving];

}

-(void)setUI{
    
     [self addSubview:self.userInfoV];
    
     [self addSubview:self.price];//价格
    
     [self addSubview:self.textView];//内容
    
     [self addSubview:self.textViewSub];//副内容
    
     [self addSubview:self.CommoditySynopsis];//商品介绍
    
     [self addSubview:self.scrollview];//图片滑动
    
     [self addSubview:self.trash];//图片滑动
     [self addSubview:self.mapBtn];//图片滑动
     [self addSubview:self.ReceiveBtn];//图片滑动

}

-(void)setMasonry{
    
    [self.userInfoV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(200);
        make.top.left.right.equalTo(self).offset(0);
    }];
    
    [self.price mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.userInfoV.mas_bottom).offset(20);
        make.left.equalTo(self).offset(16);
        make.height.mas_equalTo(27);
    }];
    
    [self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.price.mas_bottom).offset(10);
        make.left.equalTo(self).offset(20);
        make.right.equalTo(self).offset(-10);
    }];
    
    [self.textViewSub mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.textView.mas_bottom).offset(5);
        make.left.equalTo(self).offset(20);
        make.right.equalTo(self).offset(-10);
    }];
    
    [self.CommoditySynopsis mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.textViewSub.mas_bottom).offset(5);
        make.left.equalTo(self).offset(20);
        make.right.equalTo(self).offset(-10);
    }];
    
    [self.scrollview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.CommoditySynopsis.mas_bottom).offset(5);
        make.right.equalTo(self).offset(0);
        make.left.equalTo(self).offset(20);
        make.height.mas_equalTo(70);
    }];
    
    [self.trash mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.price.mas_centerY).offset(0);
        make.right.equalTo(self).offset(-15);
        make.height.width.mas_equalTo(15);
    }];
    
    [self.ReceiveBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.scrollview.mas_bottom).offset(20);
        make.right.equalTo(self).offset(-15);
        make.height.mas_equalTo(35);
        make.width.mas_equalTo(120);
        make.bottom.mas_equalTo(self).offset(-20);
    }];
    
    [self.mapBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.ReceiveBtn.mas_centerY).offset(0);
        make.left.equalTo(self).offset(15);
        make.height.mas_equalTo(15);
    }];
    
}

-(SKU_DetailTakeinUserInfoV_View_WX *)userInfoV{
    if (!_userInfoV) {
        _userInfoV = [[SKU_DetailTakeinUserInfoV_View_WX alloc]init];
        _userInfoV.backgroundColor = HexColor(0xf5f5f5);
//        [_userInfoV setCornerRadiusWithRadius:15 isMasks:YES];
//        [_userInfoV setBorderWithColor:[UIColor RGBColorWithR:224 g:224 b:224] width:1];
    }
    return _userInfoV;
}

- (BaseLab *)price{
    if (!_price) {
        _price = [BaseLab initCustomLab:@"价格" color:baseColorTheme font:[UIFont fontWithName:@"PingFangSC-Semibold" size:26]];
    }
    return _price;
}

- (BaseLab *)textView{
    if (!_textView) {
        _textView = [BaseLab initCustomLab:@"主标题主标题主标题主标题主标题主标题主标题主标题" color:HexColor(0x333333) font:[UIFont fontWithName:@"PingFangSC-Semibold" size:15]];
        _textView.numberOfLines = 0;
    }
    return _textView;
}

- (BaseLab *)textViewSub{
    if (!_textViewSub) {
        _textViewSub = [BaseLab initCustomLab:@"子标题子标题子标题子标题子标题子标题子标题子标题子标题子标题子标题子标题" color:HexColor(0x666666) font:[UIFont fontWithName:@"PingFang-SC-Regular" size:13]];
        _textViewSub.numberOfLines = 0;
    }
    return _textViewSub;
}


- (BaseLab *)CommoditySynopsis{
    if (!_CommoditySynopsis) {
        _CommoditySynopsis = [BaseLab initCustomLab:@"商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍" color:HexColor(0x000000) font:[UIFont fontWithName:@"PingFang-SC-Regular" size:13]];
        _CommoditySynopsis.numberOfLines = 0;
    }
    return _CommoditySynopsis;
}

- (BaseScrollView *)scrollview{
    if (!_scrollview) {
        _scrollview = [[BaseScrollView alloc]init];
    }
    return _scrollview;
}

-(BaseBtn *)trash{
    if (!_trash) {
        _trash = [BaseBtn initCustomBtnImageAndTitles:@[@"",@"已标记不感兴趣"] images:@[@"sku_标记不感兴趣",@""] color:@[HexColor(0x333333),baseColorTheme]];
        _trash.selected = NO;
        _trash.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:12];

        @weakify(self);
        [[_trash addTag]subscribeNext:^(id  _Nullable x) {
            @strongify(self);
//            NSLog(@"selected %@",self.trash.selected?@"YES":@"NO");
            self.trash.selected=!self.trash.selected;
            [self chageBtn];
            if (!self.trash.selected) {
                [[serviceDefualt loadNoInterestPrice:self.model.id reponseObjctClass:nil]subscribeNext:^(ResponseData* x) {
                    if (x.success) {
                        [Tools showTips:@"设置不感兴趣成功"];
                        self.trash.selected = YES;
                        [self chageBtn];
                        //                    if (self.blockRemoveCell) {
                        //                        self.blockRemoveCell(self.idnexCell);
                        //                    }
                    }else{
                        self.trash.selected = NO;
                        [self chageBtn];
                        [Tools showTips:x.errorInfo];
                    }
                }];
            }else{
                [Tools showTips:@"已设置不感兴趣"];
            }
        }];

    }
    return _trash;
}

-(void)chageBtn{
    
    if (self.trash.selected) {
        [self.trash setTitle:@"已标记不感兴趣" forState:UIControlStateNormal];
        [self.trash setTitleColor:baseColorTheme forState:UIControlStateNormal];
        [self.trash setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
        self.trash.enabled = NO;
//        self.trash .backgroundColor = [UIColor redColor];
        [self.trash mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.price.mas_centerY).offset(0);
            make.right.equalTo(self).offset(-15);
            make.width.mas_equalTo(100);
            make.height.mas_equalTo(15);
        }];
        
    }else{
        [self.trash setTitle:@"" forState:UIControlStateNormal];
        [self.trash setTitleColor:HexColor(0x333333) forState:UIControlStateNormal];
        [self.trash setImage:[UIImage imageNamed:@"sku_标记不感兴趣"] forState:UIControlStateNormal];
        
    }
}
-(BaseBtn *)mapBtn{
    if (!_mapBtn) {
        _mapBtn = [BaseBtn initCustomBtnImageAndTitles:@[@"深圳"] images:@[@"sku_定位"] color:@[HexColor(0x333333)]];
        _mapBtn.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:13];
//        _mapBtn.user

    }
    return _mapBtn;
}

-(BaseBtn *)ReceiveBtn{
    if (!_ReceiveBtn) {
        _ReceiveBtn = [BaseBtn initCustomBtnTitlestype:@[@"接受报价"] color:@[[UIColor whiteColor]]];
        _ReceiveBtn.backgroundColor = baseColorTheme;
        [_ReceiveBtn setCornerRadiusWithRadius:4 isMasks:YES];
        _ReceiveBtn.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:14];
        [[_ReceiveBtn addTag]subscribeNext:^(id  _Nullable x) {
            
            if (self.type == SKU_DetailTakeinDefault_Cell_TypePulling) {
                [self setOpenSourceBnt];
//                [[serviceDefualt loadRemindBizSourcePrice:self.opMpdel.goodsSourceId reponseObjctClass:nil]subscribeNext:^(ResponseData* x) {
//                    if (x.success) {
//                        [Tools showTips:@"提醒商家成功"];
//                        self.ReceiveBtn.enabled = NO;
//                        self.ReceiveBtn.alpha = 0.5;
//                        [self.ReceiveBtn setTitle:@"已提醒商家报价" forState:UIControlStateNormal];
//                    }else{
//                        self.ReceiveBtn.enabled = YES;
//                        [Tools showTips:x.errorInfo];
//                    }
//                }];
            }else{
                [[serviceDefualt loadacceptGoodsPrice:self.model.goodsId priceId:self.model.id reponseObjctClass:nil]subscribeNext:^(ResponseData * x) {
                    if (x.success) {
//                                            self.btnDone.enabled = NO;
                        [Tools showTips:@"接受报价成功"];
                        //                    self.btnDone.backgroundColor = baseColorLight;
                        //                    [self.btnDone setTitle:@"已接受报价" forState:UIControlStateDisabled];
                        //
                    }else{
                        //                    self.btnDone.enabled = YES;
                        
                        [Tools showTips:x.errorInfo];
                    }
                }];
            }
           
        }];
    }
    return _ReceiveBtn;
}

-(void)funcReceiveBtnPulling{
    //多种情况 一种是显示提醒 一种是禁用 点击按钮需要
    
    if (!kUSER_INFO_MANAGER.userIsLogin) {
        [Tools pushSinge];
        return ;
    }
    
    //提醒商家向我报价
    if (self.IsEnquiry) {
        
        [self showQMUIAlertAction];
        
    }else{
        [[serviceDefualt loadRemindBizSourcePrice:self.model.goodsSourceId reponseObjctClass:nil]subscribeNext:^(ResponseData* x) {
            if (x.success) {
                self.ReceiveBtn.enabled = NO;
                [Tools showTips:@"提醒商家成功"];
                self.ReceiveBtn.backgroundColor = baseColorLight;
            }else{
                self.ReceiveBtn.enabled = YES;
                [Tools showTips:x.errorInfo];
            }
        }];
    }
}



-(void)setOpenSourceBnt{

    if (!kUSER_INFO_MANAGER.userIsLogin) {
        [Tools pushSinge];
        return ;
    }
    
    //提醒商家向我报价
    if (self.IsEnquiry) {
        [self showQMUIAlertAction];
    }else{
        [[serviceDefualt loadRemindBizSourcePrice:self.opMpdel.goodsSourceId reponseObjctClass:nil]subscribeNext:^(ResponseData* x) {
            if (x.success) {
                self.ReceiveBtn.enabled = NO;
                [Tools showTips:@"提醒商家成功"];
                self.ReceiveBtn.backgroundColor = baseColorLight;
            }else{
                self.ReceiveBtn.enabled = YES;
                [Tools showTips:x.errorInfo];
            }
        }];
    }
}


-(void)showQMUIAlertAction{
    QMUIAlertAction *ac1 = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
        
    }];
    
    QMUIAlertAction *ac2 = [QMUIAlertAction actionWithTitle:@"确认" style:QMUIAlertActionStyleDestructive handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
        __weak __typeof(self)weakSelf = self;
        [[serviceDefualt loadopenEnquiry:self.goodid]subscribeNext:^(ResponseData* x) {
            if (x.success) {
                [kUSER_INFO_MANAGER MyList];
                [Tools showTips:@"开启询价成功"];
                self.IsEnquiry = NO;
//                if (weakSelf.blockChangeIsEnquiry) {
//                    weakSelf.blockChangeIsEnquiry();
//                }
            }else{
                [Tools showTips:x.errorInfo];
            }
        }];
        
    }];
    
    QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"确定开启询价?" message:@"未开启询价 无法提醒商家 是否开启询价" preferredStyle:QMUIAlertControllerStyleAlert];
    [alertController addAction:ac1];
    [alertController addAction:ac2];
    
    [alertController showWithAnimated:YES];
}






@end
